<%@ page contentType="text/html;charset=GBK" %>
<%@ page import="java.util.*" %>
<%@ page import="com.ionglobal.db.*" %>
<%@ page import="com.ionglobal.lib.*" %>
<%@ page import="com.ionglobal.cms.*" %>
<%@ page import="com.ionglobal.misc.*" %>

<%@ include file="../init_include.jsp" %>

<%
	int check_rst=Permission.accept(dbi,session,request,"sysop","tree","catid","000000010"); 	
	if (check_rst!=Permission.CHECK_RST_SUCCESS) {
		dbi.closeAll();
		if (check_rst==Permission.CHECK_RST_DENY)
			response.sendRedirect("../deny.html");
		else
			response.sendRedirect("../index.jsp");
		return;		
	}	

	int catid=0;	
	String a=request.getParameter("catid");
	String str="";
	try {
		catid=Integer.parseInt(a);		
	} catch(NumberFormatException e) {
		out.println(e+"catId");
		return;
	}
	
	CategoryInfo cinfo=new CategoryInfo("cms",catid);
	String ArchiveItem[]=cinfo.getNewName();
%>	
<html>
<head>
<title><%=ArchiveItem[0]%><%=Language.getNameByCode("cms.dateop"," Date")%></title>
<meta http-equiv="Content-Type" content="text/html; charset=<%=Language.getHTMLLanguageStr()%>">
<link rel="stylesheet" href="../css.css" type="text/css">
<script Language="JavaScript" src="../script/Ion_Popup.js"></script> 
</head>

<body class="bgcolor_title_tr">
<table width="100%" border="0" cellspacing="1" cellpadding="2" class="input_title">
  <tr>
    <td><%=Language.getNameByCode("sys.CurrentPos","Current Position")%>:<%=ArchiveItem[0]%><%=Language.getNameByCode("cms.dateop"," Date")%><br></td>
  </tr>
</table>

<form name="formIon" method="post" action="archive_changeDate.jsp">
<table width="100%" border="0" cellspacing="1" cellpadding="2" bgcolor="#666666">
<tr class="bgcolor_title_tr" align="left" valign="middle"> 
	<td class="input_title"><%=ArchiveItem[1]%></td>
	<td class="input_title"><%=Language.getNameByCode("cms.owner","Owner")%></td>
	<td class="input_title"><%=Language.getNameByCode("cms.createdate","Create Date")%></td>
	<td class="input_title"><%=Language.getNameByCode("cms.hot","Hot")%></td>
</tr>
<%	
	Vector vc=new Vector();
	String idarray="";
	if(request.getParameter("id")!=null)
		idarray=request.getParameter("id");
	if(idarray!=null && idarray.length()>0)
		idarray=idarray.substring(0,idarray.length()-1);
	String sql="select * from cms_archive where id in ("+idarray+")";
	vc=Archive.getArchives(dbi,sql);
	Archive c;
	
	String titleStrEx="";
	String titleStr="";
	int titleMaxLen=25;
	
	java.util.Date crdate;
	for (int i=0;i<vc.size();i++) {	
		str="<tr bgcolor=\"#FFFFFF\" align=\"left\" valign=\"middle\"> \n";
		c=(Archive)vc.get(i);
		titleStr=c.getTitle();
    if(titleStr == null || titleStr.trim().length() == 0 ) titleStr = "untitled";
		titleStrEx=titleStr;
		if (titleStrEx.length()>titleMaxLen) {
			titleStrEx=titleStrEx.substring(0,titleMaxLen)+"...";		
			str+= "<td>"+ titleStrEx+"</td>\n";
		} else
			str+= "<td>"+ titleStrEx+"</td>\n";
		
		titleStr="";
		titleStr=c.getCreateUser();
		str+="<td>"+titleStr+"</td>\n";
		
		crdate=c.getCreateDate();
		str+="<td><input type=\"hidden\" name=\"checkbox"+i+"\" value=\""+c.getId()+"\">";
		str+="<input type=\"text\" name=\"text"+i;
		str+="\" maxlength=\"10\" size=\"10\" value=\"";
		if (crdate!=null)	
			str+=crdate.toString();
		else
			str+="";
		str+="\"><img src=\"../images/datetime.gif\" style=\"cursor:hand;\" align=\"absmiddle\" alt=\""+Language.getNameByCode("sys.calendar","calendar")+"\"";
    str+=" onClick=\"fPopUpCalendarDlg(text"+i+");return false\" width=\"16\">(YYYY-MM-DD)</td>\n";		
		str+="<td>";
		if (c.getHot()) 
			str+=Language.getNameByCode("sys.true","true")+"</td>";
		else
			str+=Language.getNameByCode("sys.false","false")+"</td>\n";
				
		str+="</tr>\n";
		out.print(str);	
	}
%>
</table>
<input type="hidden" name="catid" value="<%=catid%>">
<input type="hidden" name="archiveNum" value="<%=vc.size()%>">
<input type="submit" name="change" value="<%=Language.getNameByCode("sys.changedate","Change Date")%>" style="width:80">
<input type="button" name="close" value="<%=Language.getNameByCode("sys.Close","Close")%>" style="width:90"  onClick='self.close();'>
</form>
</body>
</html>
<%@ include file="../init_free.jsp" %>	
